home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic new SourceCode and Projects / Webpage Maker 2000 / MainForm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-01-16  |  20.9 KB  |  639 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.Form CompanyX 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   " Webpage Maker 2000"
  6.    ClientHeight    =   3825
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   8190
  10.    Icon            =   "MainForm.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   3825
  14.    ScaleWidth      =   8190
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.Frame Frame1 
  17.       Height          =   2055
  18.       Index           =   1
  19.       Left            =   240
  20.       TabIndex        =   2
  21.       Top             =   1320
  22.       Width           =   2895
  23.       Begin VB.OptionButton Option3 
  24.          Caption         =   "Specify name:"
  25.          Height          =   255
  26.          Left            =   240
  27.          TabIndex        =   13
  28.          ToolTipText     =   "Type in a name"
  29.          Top             =   1200
  30.          Width           =   1335
  31.       End
  32.       Begin VB.OptionButton Option2 
  33.          Caption         =   "1.htm"
  34.          Height          =   255
  35.          Left            =   1680
  36.          TabIndex        =   12
  37.          Top             =   840
  38.          Value           =   -1  'True
  39.          Width           =   855
  40.       End
  41.       Begin VB.OptionButton Option1 
  42.          Caption         =   "Page1.htm"
  43.          Height          =   255
  44.          Left            =   240
  45.          TabIndex        =   11
  46.          Top             =   840
  47.          Width           =   1095
  48.       End
  49.       Begin VB.TextBox txtPageName 
  50.          Height          =   285
  51.          Left            =   240
  52.          TabIndex        =   10
  53.          Top             =   1560
  54.          Width           =   1335
  55.       End
  56.       Begin VB.Label Label17 
  57.          BackStyle       =   0  'Transparent
  58.          Caption         =   "The pages will have 1.htm after the name"
  59.          Height          =   675
  60.          Left            =   1680
  61.          TabIndex        =   30
  62.          Top             =   1320
  63.          Width           =   1260
  64.       End
  65.       Begin VB.Label Label3 
  66.          Caption         =   "The number 1 will increase up to the number of pages you create."
  67.          Height          =   435
  68.          Left            =   240
  69.          TabIndex        =   14
  70.          Top             =   240
  71.          Width           =   2415
  72.       End
  73.    End
  74.    Begin ComctlLib.ProgressBar ProgressBar1 
  75.       Height          =   225
  76.       Left            =   0
  77.       TabIndex        =   20
  78.       Top             =   3600
  79.       Visible         =   0   'False
  80.       Width           =   4815
  81.       _ExtentX        =   8493
  82.       _ExtentY        =   397
  83.       _Version        =   327682
  84.       Appearance      =   1
  85.    End
  86.    Begin ComctlLib.StatusBar StatusBar1 
  87.       Align           =   2  'Align Bottom
  88.       Height          =   255
  89.       Left            =   0
  90.       TabIndex        =   31
  91.       Top             =   3570
  92.       Width           =   8190
  93.       _ExtentX        =   14446
  94.       _ExtentY        =   450
  95.       SimpleText      =   ""
  96.       _Version        =   327682
  97.       BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
  98.          NumPanels       =   1
  99.          BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
  100.             Object.Width           =   8467
  101.             MinWidth        =   8467
  102.             Object.Tag             =   ""
  103.          EndProperty
  104.       EndProperty
  105.    End
  106.    Begin VB.Frame Frame1 
  107.       Height          =   2055
  108.       Index           =   3
  109.       Left            =   5160
  110.       TabIndex        =   22
  111.       Top             =   120
  112.       Width           =   2895
  113.       Begin ComctlLib.Slider Slider2 
  114.          Height          =   1215
  115.          Left            =   240
  116.          TabIndex        =   24
  117.          Top             =   720
  118.          Width           =   555
  119.          _ExtentX        =   979
  120.          _ExtentY        =   2143
  121.          _Version        =   327682
  122.          Orientation     =   1
  123.          LargeChange     =   1
  124.          Min             =   1
  125.          Max             =   3
  126.          SelStart        =   3
  127.          TickStyle       =   2
  128.          Value           =   3
  129.       End
  130.       Begin VB.Label Label16 
  131.          Caption         =   "Each file is 163 bytes in size."
  132.          Height          =   495
  133.          Left            =   1560
  134.          TabIndex        =   29
  135.          Top             =   1440
  136.          Width           =   1095
  137.       End
  138.       Begin VB.Label Label15 
  139.          AutoSize        =   -1  'True
  140.          Caption         =   "- 10"
  141.          Height          =   195
  142.          Left            =   840
  143.          TabIndex        =   28
  144.          Top             =   1650
  145.          Width           =   270
  146.       End
  147.       Begin VB.Label Label14 
  148.          AutoSize        =   -1  'True
  149.          Caption         =   "- 100"
  150.          Height          =   195
  151.          Left            =   840
  152.          TabIndex        =   27
  153.          Top             =   1220
  154.          Width           =   360
  155.       End
  156.       Begin VB.Label Label13 
  157.          AutoSize        =   -1  'True
  158.          Caption         =   "- 2000"
  159.          Height          =   195
  160.          Left            =   840
  161.          TabIndex        =   26
  162.          Top             =   775
  163.          Width           =   450
  164.       End
  165.       Begin VB.Label Label12 
  166.          Caption         =   "Please select maximum number of webpages to make."
  167.          Height          =   495
  168.          Left            =   240
  169.          TabIndex        =   25
  170.          Top             =   240
  171.          Width           =   2175
  172.       End
  173.    End
  174.    Begin VB.CommandButton cmdView 
  175.       Caption         =   "View"
  176.       Height          =   375
  177.       Left            =   3600
  178.       MouseIcon       =   "MainForm.frx":0442
  179.       MousePointer    =   99  'Custom
  180.       TabIndex        =   15
  181.       Top             =   1560
  182.       Width           =   855
  183.    End
  184.    Begin VB.Frame Frame2 
  185.       Height          =   2295
  186.       Left            =   3360
  187.       TabIndex        =   3
  188.       Top             =   1200
  189.       Width           =   1335
  190.       Begin VB.CommandButton cmdClear 
  191.          Caption         =   "Clear"
  192.          Height          =   375
  193.          Left            =   240
  194.          MouseIcon       =   "MainForm.frx":0594
  195.          MousePointer    =   99  'Custom
  196.          TabIndex        =   6
  197.          Top             =   1320
  198.          Width           =   855
  199.       End
  200.       Begin VB.CommandButton cmdCreate 
  201.          Caption         =   "Create"
  202.          Height          =   375
  203.          Left            =   240
  204.          MouseIcon       =   "MainForm.frx":06E6
  205.          MousePointer    =   99  'Custom
  206.          TabIndex        =   5
  207.          Top             =   840
  208.          Width           =   855
  209.       End
  210.       Begin VB.CommandButton cmdExit 
  211.          Caption         =   "Exit"
  212.          Height          =   375
  213.          Left            =   240
  214.          MouseIcon       =   "MainForm.frx":0838
  215.          MousePointer    =   99  'Custom
  216.          TabIndex        =   4
  217.          Top             =   1800
  218.          Width           =   855
  219.       End
  220.       Begin VB.Label Label11 
  221.          AutoSize        =   -1  'True
  222.          Caption         =   "Menu"
  223.          Height          =   255
  224.          Left            =   450
  225.          TabIndex        =   23
  226.          Top             =   0
  227.          Width           =   495
  228.       End
  229.    End
  230.    Begin VB.Frame Frame1 
  231.       Height          =   2055
  232.       Index           =   2
  233.       Left            =   4800
  234.       TabIndex        =   1
  235.       Top             =   1440
  236.       Width           =   2895
  237.       Begin VB.ComboBox Combo1 
  238.          Height          =   315
  239.          Left            =   240
  240.          Sorted          =   -1  'True
  241.          Style           =   2  'Dropdown List
  242.          TabIndex        =   19
  243.          Top             =   1560
  244.          Width           =   2535
  245.       End
  246.       Begin VB.TextBox txtFolder 
  247.          Height          =   285
  248.          Left            =   240
  249.          TabIndex        =   18
  250.          Top             =   1080
  251.          Width           =   2535
  252.       End
  253.       Begin VB.CommandButton cmdSearch 
  254.          Caption         =   "Search"
  255.          Height          =   375
  256.          Left            =   1920
  257.          MouseIcon       =   "MainForm.frx":098A
  258.          MousePointer    =   99  'Custom
  259.          TabIndex        =   17
  260.          Top             =   360
  261.          Width           =   855
  262.       End
  263.       Begin VB.Label Label10 
  264.          AutoSize        =   -1  'True
  265.          Caption         =   "Pages will be stored in:"
  266.          Height          =   195
  267.          Left            =   240
  268.          TabIndex        =   21
  269.          Top             =   840
  270.          Width           =   1620
  271.       End
  272.       Begin VB.Label Label9 
  273.          Caption         =   "Where do you want to store the webpages?"
  274.          Height          =   495
  275.          Left            =   120
  276.          TabIndex        =   16
  277.          Top             =   240
  278.          Width           =   1695
  279.       End
  280.    End
  281.    Begin ComctlLib.TabStrip TabStrip1 
  282.       Height          =   2535
  283.       Left            =   120
  284.       TabIndex        =   0
  285.       Top             =   960
  286.       WhatsThisHelpID =   2
  287.       Width           =   3135
  288.       _ExtentX        =   5530
  289.       _ExtentY        =   4471
  290.       _Version        =   327682
  291.       BeginProperty Tabs {0713E432-850A-101B-AFC0-4210102A8DA7} 
  292.          NumTabs         =   3
  293.          BeginProperty Tab1 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  294.             Caption         =   "Names"
  295.             Object.Tag             =   ""
  296.             ImageVarType    =   2
  297.          EndProperty
  298.          BeginProperty Tab2 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  299.             Caption         =   "Folders"
  300.             Object.Tag             =   ""
  301.             ImageVarType    =   2
  302.          EndProperty
  303.          BeginProperty Tab3 {0713F341-850A-101B-AFC0-4210102A8DA7} 
  304.             Caption         =   "Options"
  305.             Object.Tag             =   ""
  306.             ImageVarType    =   2
  307.          EndProperty
  308.       EndProperty
  309.       MousePointer    =   99
  310.       MouseIcon       =   "MainForm.frx":0ADC
  311.    End
  312.    Begin ComctlLib.Slider Slider1 
  313.       Height          =   495
  314.       Left            =   120
  315.       TabIndex        =   7
  316.       TabStop         =   0   'False
  317.       Top             =   360
  318.       Width           =   4575
  319.       _ExtentX        =   8070
  320.       _ExtentY        =   873
  321.       _Version        =   327682
  322.       LargeChange     =   1
  323.       SmallChange     =   50
  324.    End
  325.    Begin VB.Label Label2 
  326.       AutoSize        =   -1  'True
  327.       Height          =   195
  328.       Left            =   2880
  329.       TabIndex        =   9
  330.       Top             =   120
  331.       Width           =   165
  332.    End
  333.    Begin VB.Label Label1 
  334.       Caption         =   "Number of new webpages to make:"
  335.       Height          =   195
  336.       Left            =   240
  337.       TabIndex        =   8
  338.       Top             =   120
  339.       Width           =   2610
  340.    End
  341. Attribute VB_Name = "CompanyX"
  342. Attribute VB_GlobalNameSpace = False
  343. Attribute VB_Creatable = False
  344. Attribute VB_PredeclaredId = True
  345. Attribute VB_Exposed = False
  346. '#################################################'
  347. '## ##  -----------------------------------  ## ##'
  348. '## ##  Program name: Webpage Maker 2000     ## ##'
  349. '## ##  Started in: October, 1999            ## ##'
  350. '## ##  Author: David VanHook                ## ##'
  351. '## ##  -----------------------------------  ## ##'
  352. '#################################################'
  353. '----------------------VARIABLE SECTION-----------------------'
  354. Option Explicit
  355. Const Numtabs = 3            'Set the number of tabs
  356. Dim x As Integer             'For/Next loop variable
  357. Dim strPageType As String    'Name of pages to create
  358. Dim strFolders As String     'Frequently used folders
  359. 'Ini File Variables
  360. Dim File As String           'Path and name of INI file
  361. Dim NewNumber As Integer     'INI file return variable
  362. Dim numPages As String       'Number of pages to create
  363. Dim secTitle As String       'Section of INI file [Preferences]
  364. Dim subSecTitle As String    'Subsection of INI file
  365. '---------------------CLEAR ALL TEXTBOXES---------------------'
  366. Private Sub cmdClear_Click()
  367.   txtPageName.Text = ""
  368.   Slider1.Value = 0
  369.   txtFolder.Text = ""
  370. End Sub
  371. '---------------------CREATE NEW WEBPAGES---------------------'
  372. Private Sub cmdCreate_Click()
  373.   On Error GoTo oh_no
  374.   x = 0
  375.   Template.rtbDefault.LoadFile "Template.txt"
  376.   Template.rtbDefault.Refresh
  377.   If Slider1.Value = 0 Then
  378.     Call MsgBox("How many new pages?", vbQuestion, "How many pages?")
  379.     Exit Sub
  380.   End If
  381.   If Slider1.Value = 666 Then
  382.     Call MsgBox("666 PAGES?", vbCritical, " - YOU ARE THE DEVIL -")
  383.     Exit Sub
  384.   End If
  385.   '--------------------------------
  386.   'User selected to name the pages
  387.   'but didn't type in a name
  388.   '--------------------------------
  389.   If txtPageName = "" And Option3.Value = True Then
  390.     Call MsgBox("Please select a Page Name.", vbCritical, "No Page Name")
  391.     TabStrip1.Tabs(1).Selected = True
  392.     Frame1(1).Visible = True
  393.     Exit Sub
  394.   End If
  395.   '--------------------------------
  396.   'No folder was selected
  397.   'to store webpages in
  398.   '--------------------------------
  399.   If txtFolder.Text = "" Then
  400.     Call MsgBox("Please select a Folder.", vbCritical, "No Folder selected")
  401.     TabStrip1.Tabs(2).Selected = True
  402.     Frame1(2).Visible = True
  403.     Exit Sub
  404.   End If
  405.   If Left(txtFolder.Text, 3) <> "C:\" Then
  406.     Call MsgBox("Invalid storage path specified.", vbCritical, " Folder does not exist")
  407.     txtFolder.Text = ""
  408.     Exit Sub
  409.   End If
  410.   'Pages will be named: Page1.htm
  411.   '                     Page2.htm
  412.   '                     and so on...
  413.   If Option1.Value = True Then
  414.     strPageType = "Page"
  415.   Else
  416.         
  417.     'Pages will be named: 1.htm
  418.     '                     2.htm
  419.     '                     and so on...
  420.     If Option2.Value = True Then
  421.       strPageType = ""
  422.     Else
  423.             
  424.         'Pages will be named: something1.htm
  425.         '                     something2.htm
  426.         '                     and so on...
  427.         If Option3.Value = True Then
  428.           strPageType = txtPageName.Text
  429.         End If
  430.         
  431.     End If
  432.         
  433.   End If
  434.   '---------------------------
  435.   'Create more than 1 webpage
  436.   '---------------------------
  437.   If Slider1.Value > 1 Then
  438.     If MsgBox("Create " & Slider1.Value & " webpages?  Are you sure?", vbQuestion + vbYesNo, " Really?") = vbYes Then
  439.       ProgressBar1.Visible = True
  440.       cmdCreate.MousePointer = 0
  441.             
  442.       For x = 1 To Slider1.Value
  443.         ProgressBar1.Value = x
  444.         Open txtFolder.Text & "\" & strPageType & x & ".htm" For Output As #2
  445.         ProgressBar1.Max = Slider1.Value
  446.         Print #2, Template.rtbDefault.Text
  447.         Close #2
  448.       Next x
  449.             
  450.     Else
  451.       Exit Sub
  452.     End If
  453.   Else
  454.             
  455.   '---------------------------
  456.   'Create only 1 webpage
  457.   '---------------------------
  458.     If Slider1.Value = 1 Then
  459.                 
  460.       If MsgBox("Create 1 webpage?  Are you sure?", vbQuestion + vbYesNo, " Really?") = vbYes Then
  461.         x = 1
  462.         ProgressBar1.Value = x
  463.         Open txtFolder.Text & "\" & strPageType & "1.htm" For Output As #2
  464.         ProgressBar1.Visible = True
  465.         ProgressBar1.Max = Slider1.Value
  466.         Print #2, Template.rtbDefault.Text
  467.         Close #2
  468.         ProgressBar1.Visible = False
  469.         Slider1.Visible = True
  470.         Call MsgBox("New webpage complete!", vbExclamation, " Done")
  471.         Exit Sub
  472.       Else
  473.         Exit Sub
  474.       End If
  475.                 
  476.     End If
  477.             
  478.                 
  479.   End If
  480.   cmdCreate.MousePointer = 99
  481.   ProgressBar1.Visible = False
  482.   Call MsgBox("New webpages complete!", vbExclamation, " Done")
  483.   Exit Sub
  484. oh_no:
  485. Call MsgBox("Invalid storage path specified.", vbCritical, " Folder does not exist")
  486. cmdCreate.MousePointer = 99
  487. txtFolder.Text = ""
  488. ProgressBar1.Visible = False
  489. TabStrip1.Tabs(2).Selected = True
  490. Frame1(2).Visible = True
  491. Exit Sub
  492. End Sub
  493. '------------------------EXIT PROGRAM-------------------------'
  494. Private Sub cmdExit_Click()
  495.   '---------------------------------
  496.   ' When exiting the program, save
  497.   ' number of pages in the INI file
  498.   '---------------------------------
  499.   File = App.Path & "\wpm2000.ini" 'Path and file name of ini
  500.   secTitle = "Preferences"  'Section name
  501.   subSecTitle = "Number of Pages" 'Subsection
  502.   numPages = Slider1.Max 'Value to save
  503.   NewNumber = WritePrivateProfileString(secTitle, subSecTitle, numPages, File)
  504.   Unload Folders
  505.   Unload Template
  506.   Unload Me
  507. End Sub
  508. '----------------FIND FOLDER TO STORE PAGES IN----------------'
  509. Private Sub cmdSearch_Click()
  510.   Folders.Show
  511. End Sub
  512. '---------------------VIEW PAGE TEMPLATE----------------------'
  513. Private Sub cmdView_Click()
  514.   Template.Show
  515. End Sub
  516. '------------------FREQUENTLY USED FOLDERS--------------------'
  517. Private Sub Combo1_Click()
  518.   txtFolder.Text = Combo1.List(Combo1.ListIndex)
  519. End Sub
  520. '--------------------FORM UNLOAD SECTION----------------------'
  521. Private Sub Form_Unload(Cancel As Integer)
  522.   Unload Template
  523.   Unload Folders
  524. End Sub
  525. '-------------------SELECT NAME FOR PAGES---------------------'
  526. Private Sub Option3_Click()
  527.   txtPageName.SetFocus
  528. End Sub
  529. '---------------SHOW NUMBER OF PAGES TO MAKE------------------'
  530. Private Sub Slider1_Change()
  531.   Label2.Caption = Slider1.Value
  532. End Sub
  533. '---------------------UPDATE TICK MARKS-----------------------'
  534. Private Sub Slider1_Scroll()
  535.   Slider1_Change
  536. End Sub
  537. Private Sub Slider2_Change()
  538.   Select Case Slider2.Value
  539.     Case Is = 1
  540.       Slider1.Max = "2000"
  541.       Slider1.TickFrequency = 100
  542.       Slider1.Value = 2000
  543.       Label2.Caption = "2000"
  544.       
  545.     Case Is = 2
  546.       Slider1.Max = "100"
  547.       Slider1.TickFrequency = 5
  548.       Slider1.Value = 100
  549.       Label2.Caption = "100"
  550.             
  551.     Case Is = 3
  552.       Slider1.Max = "10"
  553.       Slider1.TickFrequency = 1
  554.       Slider1.Value = 10
  555.       Label2.Caption = "10"
  556.             
  557.   End Select
  558.         
  559. End Sub
  560. Private Sub Slider2_Click()
  561.   Slider2_Change
  562. End Sub
  563. Private Sub Slider2_Scroll()
  564.   Slider2_Change
  565. End Sub
  566. '----------------------TABSTRIP SECTION-----------------------'
  567. Private Sub TabStrip1_Click()
  568.   'This procedure determines which tab is selected
  569.   'and what tab container should be shown
  570.   Static PrevTab As Integer
  571.   PrevTab = Switch(PrevTab = 0, 1, PrevTab >= 1 And PrevTab <= Numtabs, PrevTab)
  572.   Frame1(PrevTab).Visible = False
  573.   Frame1(TabStrip1.SelectedItem.Index).Visible = True
  574.   Frame1(TabStrip1.SelectedItem.Index).Refresh
  575.   PrevTab = TabStrip1.SelectedItem.Index
  576. End Sub
  577. '---------------------FORM LOAD SECTION-----------------------'
  578. Private Sub Form_Load()
  579.   On Error Resume Next
  580.   '----------------------------------
  581.   ' Set the height and width of form
  582.   '----------------------------------
  583.   CompanyX.Width = 4900
  584.   CompanyX.Height = 4200
  585.   For x = 1 To Numtabs 'Loop through the tabs
  586.     With Frame1(x)
  587.       .Left = TabStrip1.ClientLeft + 50
  588.       .Top = TabStrip1.ClientTop + 50
  589.       .Width = TabStrip1.ClientWidth - 100
  590.       .Height = TabStrip1.ClientHeight - 100
  591.       .Visible = False
  592.     End With
  593.   Next x
  594.   TabStrip1.Tabs(1).Selected = True 'Form loads with first tab selected
  595.   Frame1(1).Visible = True 'Show first container
  596.   Label2.Caption = "0"
  597.   '----------------
  598.   ' Ini file values
  599.   '----------------
  600.   Dim Temp As String * 75
  601.   Dim getnumPages As Long
  602.   File = App.Path & "\wpm2000.ini"
  603.   secTitle = "Preferences"
  604.   subSecTitle = "Number of Pages"
  605.   getnumPages = GetPrivateProfileString(secTitle, subSecTitle, File, Temp, Len(Temp), File)
  606.   Slider1.Max = Temp
  607.   Select Case Slider1.Max
  608.     Case Is = "2000"
  609.       Slider1.TickFrequency = 100
  610.       Slider1.Value = 2000
  611.       Label2.Caption = "2000"
  612.       Slider2.Value = 1
  613.             
  614.     Case Is = "100"
  615.       Slider1.TickFrequency = 5
  616.       Slider1.Value = 100
  617.       Label2.Caption = "100"
  618.       Slider2.Value = 2
  619.             
  620.     Case Is = "10"
  621.       Slider1.TickFrequency = 1
  622.       Slider1.Value = 10
  623.       Label2.Caption = "10"
  624.       Slider2.Value = 3
  625.             
  626.   End Select
  627.   File = App.Path & "\wpm2000.ini" 'Path and file name of ini
  628.   secTitle = "Folders" 'Section name
  629.   Temp = ""
  630.   For x = 0 To 20
  631.     subSecTitle = "Favorite Folders" & x 'Subsection
  632.     getnumPages = GetPrivateProfileString(secTitle, subSecTitle, File, Temp, Len(Temp), File)
  633.     If InStr(Temp, ".ini") Then Exit For
  634.     Combo1.AddItem Temp
  635.     If Temp = Combo1.List(x - 1) Then Exit For
  636.   Next x
  637.   Close #1
  638. End Sub
  639.